package com.kmu.wmy.factory;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateFactory {
    public static Session getSession() {
        try {
            Configuration configuration = new Configuration();
            configuration.configure();
            SessionFactory ourSessionFactory = configuration.buildSessionFactory();
            return ourSessionFactory.openSession();
        } catch (Throwable ex) {
            throw new ExceptionInInitializerError(ex);
        }
    }
}
